package org.come.Jpanel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTextField;

import org.come.Frame.WorkshopRefiningJframe;
import org.come.Frame.ZhuFrame;
import org.come.bean.ConfigureBean;
import org.come.bean.LoginResult;
import org.come.bean.QualityClBean;
import org.come.bean.Skill;
import org.come.bean.SuitOperBean;
import org.come.entity.Goodstable;
import org.come.entity.RefiningValue;
import org.come.model.Configure;
import org.come.model.LianHua;
import org.come.socket.Agreement;
import org.come.socket.GameClient;
import org.come.socket.SendMessageUntil;
import org.come.until.AlchemyTXT;
import org.come.until.CutButtonImage;
import org.come.until.FormsManagement;
import org.come.until.GoodsListFromServerUntil;
import org.come.until.GsonUtil;
import org.come.until.RefiningUtil;
import org.come.until.UserMessUntil;
import org.skill.panel.SkillSMSelectOptionJpanel;

import com.tool.btn.BaptizeBtn;
import com.tool.btn.FormsOnOffBtn;
import com.tool.btn.RefineOperBtn;
import com.tool.role.RoleData;
import com.tool.tcpimg.UIUtils;
import com.tool.time.Limit;
import com.tool.time.TimeLimit;
import com.updateNew.MyIsif;



public class NewRefiningJpanel extends JPanel {
    private final RefineOperBtn operBtn1;// 保留原属性
    private final RefineOperBtn operBtn2;// 替换新属性
    private final RefineOperBtn operBtn3;// 再次炼化
    private RefineOperBtn btnDown;// 下拉框
    public static JLabel[] jLabels;
    private SkillSMSelectOptionJpanel optionJpanel;// 下拉框
    private final JLabel labName;
    private static JTextField findName,findName1;
    private static JLabel labtext1;

    private AlchemyTXT alchemyTXT;
    private List<Map<String, String>> alchemyList;
    public NewRefiningJpanel() {
        alchemyList = AlchemyTXT.getAlchemyList();
        this.setPreferredSize(new Dimension(560, 375));
        this.setLayout(null);
        this.setBackground(UIUtils.Color_BACK);
        // 关闭按钮事件
        FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/old/2/1.png", 1, 11);
        offBtn.setBounds(560 - 37, 10, 25, 25);
        this.add(offBtn);
        // 保留原属性
        operBtn1 = new RefineOperBtn("skin/8100226/newbutton/B22.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, this, 0,
                "保留属性");
        operBtn1.setBounds(103, 330, 99, 24);
        this.add(operBtn1);
        // 替换新属性
        operBtn2 = new RefineOperBtn("skin/8100226/newbutton/B22.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, this, 1,
                "替换属性");
        operBtn2.setBounds(363, 330, 99, 24);
        this.add(operBtn2);
        // 再次炼化
        operBtn3 = new RefineOperBtn("skin/8100226/newbutton/B22.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, this, 2,
                "再次炼化");
        operBtn3.setBounds(415, 45, 99, 24);
        this.add(operBtn3);
        jLabels = new JLabel[6];
        for (int i = 0; i < jLabels.length; i++) {
            jLabels[i] = new JLabel();
            jLabels[i].setBounds(171, 111 + i * 30, 13, 13);
            jLabels[i].addMouseListener(new Gmouslisten(i));
            jLabels[i].setVisible(false);
            this.add(jLabels[i]);
        }
        labName = new JLabel();
        labName.setBounds(72, 24, 96, 16);
        labName.setForeground(Color.white);
        labName.setFont(UIUtils.TEXT_HY16);
        this.add(labName);
        String[] rowData = { "初学乍练", "初窥门径", "略有小成", "融会贯通", "心领神会", "炉火纯青" };
        optionJpanel = new SkillSMSelectOptionJpanel(98, 120, "inkImg/old/background/15.png", rowData);
        optionJpanel.setBounds(72, 40, 98, 120);
        this.add(optionJpanel);
        optionJpanel.getJlist().addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                String value = getValue(true);
                addValues(value, 0, false);
                if(value!=null){
                    optionJpanel.setVisible(false);
                }
            }
        });
        btnDown = new RefineOperBtn("skin/8100226/button/8.png", 1, this, 3);
        btnDown.setBounds(151, 23, 18, 18);
        this.add(btnDown);


//        Font font = new Font("楷体", 0, 16);
//        labtext1 = new JLabel();
//        labtext1.setForeground(Color.yellow);
//        labtext1.setFont(font);
//        labtext1.setBounds(40, 39, 128, 18);
//        labtext1.setText("炼化属性：");
//        this.add(labtext1);

        findName = new JTextField();// 炼化属性输入
        findName.setBounds(110, 48, 228, 18);
        findName.setOpaque(false);
        findName.setBorder(BorderFactory.createEmptyBorder());
        findName.setForeground(Color.white);
        findName.setCaretColor(Color.white);
        findName.setFont(new Font("宋体",Font.PLAIN,14));
        this.add(findName);

    }
    /**获取修炼属性*/
    public String getValue(boolean type) {
        JList<String> jlist = optionJpanel.getJlist();
        int selectedIndex = jlist.getSelectedIndex();
        if (selectedIndex == -1) {
            return null;
        }
        Limit limit = TimeLimit.getLimits().getLimit("单人竞技场");
        if (limit == null) {
            if (type) {
                ZhuFrame.getZhuJpanel().addPrompt2("你还未获得称号");
            }
            return null;
        }
        String[] split = limit.getValue().split("\\|");
        String selectedValue = jlist.getSelectedValue();
        if (split.length < (selectedIndex + 1)) {
            if (type) {
                ZhuFrame.getZhuJpanel().addPrompt2("你还未获得" + selectedValue + "称号");
            }
            return null;
        }
        labName.setText(selectedValue);
        return split[selectedIndex];
    }

    /** 再次炼化操作 */
    public void selectArenaIndex() {
        JList<String> jlist = optionJpanel.getJlist();
        int selectedIndex = jlist.getSelectedIndex();
        if (selectedIndex == -1) {
            ZhuFrame.getZhuJpanel().addPrompt2("请先选择一个称号");
            return;
        }
        if (RoleData.getRoleData().getLoginResult().getGold().compareTo(new BigDecimal(1000000)) < 0) {
            ZhuFrame.getZhuJpanel().addPrompt2("大话币不足10万,无法再次炼化");
            return;
        }
        List<Goodstable> chaxunss = GoodsListFromServerUntil.chaxunss(119);
        if (chaxunss.size() == 0) {
            ZhuFrame.getZhuJpanel().addPrompt2("炼化道具不足,无法再次炼化");
            return;
        }
        Goodstable goodstable = chaxunss.get(0);
        Limit limit = TimeLimit.getLimits().getLimit("单人竞技场");
        if (limit == null) {
            ZhuFrame.getZhuJpanel().addPrompt2("你还未获得称号");
            return;
        }
        String[] split = limit.getValue().split("\\|");
        if (split.length < (selectedIndex + 1)) {
            String selectedValue = jlist.getSelectedValue();
            ZhuFrame.getZhuJpanel().addPrompt2("你还未获得" + selectedValue + "称号");
            return;
        }
        SuitOperBean operBean = new SuitOperBean();
        operBean.setType(70 + selectedIndex + 1);
        List<BigDecimal> list = new ArrayList<>();
        list.add(goodstable.getRgid());
        operBean.setGoods(list);
        String sendmes = Agreement.suitOperateAgreement(GsonUtil.getGsonUtil().getgson().toJson(operBean));
        SendMessageUntil.toServer(sendmes);


    }

    /** 显示 */
    public void show(String value, int leixing, boolean is) {
        for (int i = 0; i < jLabels.length; i++) {
            jLabels[i].setIcon(null);
            jLabels[i].setVisible(false);
        }
        msg = null;
        this.leixing = leixing;
        String concealArena = concealArena(leixing == 4);
        if(leixing == 4){
            value = concealArena;
        }
        addValues(value, 0, is);
//        FormsManagement.upgradForm(11);
        FormsManagement.showForm(11);
    }
    /** 隐藏或展示竞技称号炼化 */
    public String concealArena(boolean type) {
        optionJpanel.setVisible(false);
        btnDown.setVisible(type);
        labName.setVisible(type);
        if(type){
            return getValue(false);
        }
        return null;
    }


    /** 展示与隐藏下拉框 */
    public void showArenaDownLab() {
        optionJpanel.setVisible(!optionJpanel.isVisible());
    }

    /** 获取额外属性 */
    public void ew(QualityClBean clBean) {
        if (clBean.getType() == -2) {
            TH(clBean);
//            String text = ZhuFrame.getZhuJpanel().getSendMes().getText();
            String text = findName.getText();
            text = text.replaceAll("\\s*", "");
            if ("".equals(text)) {
                return;
            }else {
//            	LoginResult loginResult = RoleData.getRoleData().getLoginResult();
//            	if(loginResult.getGmshoptype()==null || loginResult.getGmshoptype().equals("")) {
//            		text="";
//            		ZhuFrame.getZhuJpanel().addPrompt2("您还未开通特权,本次常规炼化");
//            		findName.setText("");
//            	}
            }
            String[] vs = text.split("\\|");
            if (!"炼器".equals(vs[0])) {
                return;
            }
            boolean f = false;
            for (int i = 1; i < vs.length; i++) {
                String[] v = vs[i].split("=");
                if(alchemyList!=null &&alchemyList.size()>0) {
                    for(Map<String, String> maps:alchemyList) {
                        if(maps.keySet().contains("武器开光")) {
                            if(v[0].equals(maps.get("武器开光"))) {
                                f=true;
                            }
                        }
                    }
                }


                if(f) {
                    String s = v[1].replace(" ", "");
                    int size = 0;
                    for (int sc = 0; sc < jLabels.length; sc++) {
                        if (jLabels[sc].getIcon() != null) {
                            size++;
                        }
                    }
                    if(Integer.parseInt(s)<6) {
                        if (v.length == 1) {
                            if (clBean.getNewAttr().indexOf(vs[i]) != -1) {
                                return;
                            }
                        } else {
                            if (Integer.parseInt(v[1]) <= getCount(clBean.getNewAttr(), v[0])) {
                                return;
                            }
                        }
                    }else {
                        ZhuFrame.getZhuJpanel().addPrompt2("格式错误,最多只能炼化5条！最后数字不能大于5！");
                        return;
                    }
                    if(size!=(Integer.parseInt(s)-1)) {
                        ZhuFrame.getZhuJpanel().addPrompt2("格式错误,请先锁定"+(Integer.parseInt(s)-1)+"条数据！");
                        return;
                    }
                }else {
                    ZhuFrame.getZhuJpanel().addPrompt2("格式错误，没有【"+v[0]+"】这样的属性！");
                    return;
                }
            }
            try {
                Thread.sleep(500);
            } catch (Exception e) {
            }
            RefinersJpanel rJpanel = WorkshopRefiningJframe.getWorkshopRefiningJframe().getWorkshopRefiningJpanel()
                    .getCardJpanel().getRefinersJpanel();
            String v = rJpanel.detection();
            if ("炼器".equals(v)) {
                operBtn1.cao1(rJpanel.goods, rJpanel.money, 1);
            }
        } else if (clBean.getType() == 1) {
            this.clBean = clBean;
            addValues(clBean.getNewAttr(), 1, false);
//            String text = ZhuFrame.getZhuJpanel().getSendMes().getText();
            String text = findName.getText();
            if ("".equals(text)) {
                return;
            }else {
//            	LoginResult loginResult = RoleData.getRoleData().getLoginResult();
//            	if(loginResult.getGmshoptype()==null || loginResult.getGmshoptype().equals("")) {
//            		text="";
//            		ZhuFrame.getZhuJpanel().addPrompt2("您还未开通特权,本次常规炼化");
//            		findName.setText("");
//            		return;
//            	}
            }

            String[] vs = text.split("\\|");
            if (!"炼化".equals(vs[0])) {
                ZhuFrame.getZhuJpanel().addPrompt2("格式错误，开头请写【炼化】");
                return;
            }
            RefiningEquiJpanel EJpanel = WorkshopRefiningJframe.getWorkshopRefiningJframe().getWorkshopRefiningJpanel()
                    .getCardJpanel().getEquiJpanel();
            String vstype = RefiningUtil.detection(EJpanel.goods, EJpanel.getType());
            boolean f = false;
            for (int i = 1; i < vs.length; i++) {
                String[] v = vs[i].split("=");
                if(alchemyList!=null &&alchemyList.size()>0) {
                    for(Map<String, String> maps:alchemyList) {
                        if("炼化仙器".equals(vstype)) {
                            if("7004".equals(EJpanel.goods[0].getType().toString())) {
                                if(maps.keySet().contains("仙器武器")) {
                                    if(v[0].equals(maps.get("仙器武器"))) {
                                        f=true;
                                    }
                                }
                            }
                            if("7000".equals(EJpanel.goods[0].getType().toString())) {
                                if(maps.keySet().contains("仙器衣服")) {
                                    if(v[0].equals(maps.get("仙器衣服"))) {
                                        f=true;
                                    }
                                }
                            }
                            if("7003".equals(EJpanel.goods[0].getType().toString())) {
                                if(maps.keySet().contains("仙器鞋子")) {
                                    if(v[0].equals(maps.get("仙器鞋子"))) {
                                        f=true;
                                    }
                                }
                            }
                            if("7001".equals(EJpanel.goods[0].getType().toString())) {
                                if(maps.keySet().contains("仙器帽子")) {
                                    if(v[0].equals(maps.get("仙器帽子"))) {
                                        f=true;
                                    }
                                }
                            }
                            if("7002".equals(EJpanel.goods[0].getType().toString())) {
                                if(maps.keySet().contains("仙器项链")) {
                                    if(v[0].equals(maps.get("仙器项链"))) {
                                        f=true;
                                    }
                                }
                            }
                        }
                    }
                }
                if(f) {
                    String s = v[1].replace(" ", "");
                    int size = 0;
                    for (int sc = 0; sc < jLabels.length; sc++) {
                        if (jLabels[sc].getIcon() != null) {
                            size++;
                        }
                    }
                    if(Integer.parseInt(s)<6) {
                        if (v.length == 1) {
                            if (clBean.getNewAttr().indexOf(vs[i]) != -1) {
                                return;
                            }
                        } else {
                            if (Integer.parseInt(v[1]) <= getCount(clBean.getNewAttr(), v[0])) {
                                return;
                            }
                        }
                    }else {
                        ZhuFrame.getZhuJpanel().addPrompt2("格式错误,最多只能炼化5条！最后数字不能大于5！");
                        return;
                    }
                    if(size!=(Integer.parseInt(s)-1)) {
                        ZhuFrame.getZhuJpanel().addPrompt2("格式错误,请先锁定"+(Integer.parseInt(s)-1)+"条数据！");
                        return;
                    }
                }else {
                    ZhuFrame.getZhuJpanel().addPrompt2("格式错误，没有【"+v[0]+"】这样的属性！");
                    return;
                }
            }
            try {
                //输入框输入炼化自动炼化时间
                Thread.sleep(500);
            } catch (Exception e) {
            }
//            RefiningEquiJpanel EJpanel = WorkshopRefiningJframe.getWorkshopRefiningJframe().getWorkshopRefiningJpanel()
//                    .getCardJpanel().getEquiJpanel();
            String v = RefiningUtil.detection(EJpanel.goods, EJpanel.getType());
            if ("炼化装备".equals(v) || "炼化仙器".equals(v) || "炼化神兵".equals(v)) {
                operBtn1.cao1(EJpanel.goods, EJpanel.money, 4);
            }
        } else if (clBean.getType() == 53) {
            this.clBean = clBean;
            addValues(clBean.getNewAttr(), 1, false);

        } else if (clBean.getType() == 54) {
            this.clBean = clBean;
            addValues(clBean.getNewAttr(), 1, false);
        } else if (clBean.getType() >= 71 && clBean.getType() <= 76) {
            this.clBean = clBean;
            addValues(clBean.getNewAttr(), 1, false);
        }
    }

    /** 字符串在另一个字符串出现的次数 */
    public static int getCount(String source, String sub) {
        int count = 0;
        int length = source.length() - sub.length();
        for (int i = 0; i < length; i++) {
            String sourceBak = source.substring(i, i + sub.length());
            int index = sourceBak.indexOf(sub);
            if (index != -1) {
                count++;
            }
        }
        return count;
    }

    /** 替换属性 */
    public void TH(QualityClBean clBean) {
        if (clBean.getType() >= 71 && clBean.getType() <= 76) {
            this.leixing = 4;
            addValues(clBean.getNewAttr(), 0, false);
        }else {
            Goodstable good = GoodsListFromServerUntil.getRgid(clBean.getRgid());
            if (good != null) {
                if (clBean.getType() == 2 || clBean.getType() == -2) {
                    this.leixing = 1;
                    good.setValue(BaptizeBtn.newExtra(good.getValue().split("\\|"), 1, clBean.getNewAttr()));
                    addValues(clBean.getNewAttr(), 0, true);
                } else if (clBean.getType() == 1) {
                    this.leixing = 0;
                    good.setValue(BaptizeBtn.newExtra(good.getValue().split("\\|"), 0, clBean.getNewAttr()));
                    addValues(clBean.getNewAttr(), 0, true);
                } else if (clBean.getType() == 53) {
                    this.leixing = 2;
                    good.setValue(BaptizeBtn.newExtra(good.getValue().split("\\|"), 0, clBean.getNewAttr()));
                    addValues(clBean.getNewAttr(), 0, false);
                } else if (clBean.getType() == 54) {
                    this.leixing = 3;
                    good.setValue(BaptizeBtn.newExtra(good.getValue().split("\\|"), 6, clBean.getNewAttr()));
                    addValues(clBean.getNewAttr(), 0, false);
                }
            } else {
                addValues(null, 0, false);
            }
        }

        this.clBean = null;
    }

    public QualityClBean clBean;
    public int leixing;// 面板类型是炼化还是炼器 0炼化 1炼器 2星卡重洗神通 3星卡重洗五行 4竞技称号炼化
    public static List<RefiningValue> values = new ArrayList<>();

    /** 添加炼化属性 */
    public void addValues(String v, int type, boolean is) {
        int x = 25;
        if (type == 0) {// 现在物品属性
            for (int i = 0; i < jLabels.length; i++) {
                jLabels[i].setVisible(false);
            }
            if (leixing == 0) {
                msg = null;
            }
            clBean = null;
            values.clear();
            x = 25;
        } else if (type == 1) {// 右边属性
            for (int i = values.size() - 1; i >= 0; i--) {
                if (values.get(i).getX() != 25) {
                    values.remove(i);
                }
            }
            x = 290;
        }
        if (v == null || "".equals(v)) {
            return;
        }
        String[] vs = v.split("&");
        int size = 0;
        if (leixing == 0 || leixing == 1) {
            for (int i = leixing == 0 ? 1 : 2; i < vs.length; i++) {
                if (is) {
                    jLabels[size].setVisible(true);
                }
                String[] vss = vs[i].split("=");
                if (!"特技".equals(vss[0])) {
                    RefiningValue value = new RefiningValue(x, 105 + size * 30, vss[0], vss[1]
                            + GoodsMsgJpanel.tianjia(vss[0]), is);
                    values.add(value);
                    size++;
                } else {
                    for (int j = 1; j < vss.length; j++) {
                        Skill skill = UserMessUntil.getSkillId(vss[j]);
                        if (skill != null) {
                            RefiningValue value = new RefiningValue(x, 105 + size * 30, vss[0], skill.getSkillname(), is);
                            values.add(value);
                            size++;
                        }
                    }
                }
            }
        } else if (leixing == 2 || leixing == 3) {// 星卡重洗神通或者重洗五行
            for (int i = 1; i < vs.length; i++) {
                if (is) {
                    jLabels[size].setVisible(true);
                }
                String[] vss = vs[i].split("=");
                if (!"星阵 ".equals(vss[0])) {
                    RefiningValue value = new RefiningValue(x, 105 + size * 30, vss[0], vss[1]
                            + GoodsMsgJpanel.tianjia(vss[0]), is);
                    values.add(value);
                    size++;
                } else {
                    RefiningValue value = new RefiningValue(x, 105 + size * 30, vss[1], vss[2], is);
                    values.add(value);
                    size++;
                }
            }
        } else if (leixing == 4) {// 竞技称号炼化
            for (int i = 0; i < vs.length; i++) {
                if (is) {
                    jLabels[size].setVisible(true);
                }
                String[] vss = vs[i].split("=");
                RefiningValue value = new RefiningValue(x, 105 + size * 30, vss[0], vss[1], is);
                values.add(value);
                size++;
            }
        }
        boolean is2 = false;
        if (type == 0) {
            if (leixing == 1) {
                for (int i = 0; i < jLabels.length; i++) {
                    if (jLabels[i].getIcon() != null && i >= values.size()) {
                        is2 = true;
                        ZhuFrame.getZhuJpanel().addPrompt2("请重新锁定");
                        break;
                    }
                }
            } else {
                is2 = true;
            }
        }
        if (is2) {
            for (int i = 0; i < jLabels.length; i++) {
                jLabels[i].setIcon(null);
            }
        }
    }

    private ImageIcon icon;
    private ImageIcon iconTitle;
    private String msg;

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        if (icon == null) {
            icon = new ImageIcon("inkImg/newbackground/B281.png");
        }
        // 背景
        g.drawImage(icon.getImage(), 0, 0, 560, 375, this);
        g.setColor(Color.white);
        if (leixing != 4) {
            g.drawString(RoleData.getRoleData().getLoginResult().getCodecard().toString(), 75, 36);
        } else {
            if (iconTitle == null) {
                iconTitle = CutButtonImage.getImage("inkImg/newbackground/S300.png", 42, 28);
            }
            g.drawImage(iconTitle.getImage(), 28, 18, 42, 28, null);
        }
        g.setColor(UIUtils.COLOR_HIHT);
        if (msg != null) {
            g.drawString(msg, 170, 36);
        }
        g.setFont(UIUtils.TEXT_HURT2);
        for (RefiningValue value : values) {
            value.draw(g);
        }
    }

    /** 位置点击 0取消 1是点击 */
    public void click(int p, int type) {
        ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
        Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
        Configure configure = item.get(new BigDecimal(1));

        if(!"开".equals(configure.getLxsdkg())){
            ZhuFrame.getZhuJpanel().addPrompt2("当前版本不可锁定！");
            return;
        }
        int snum = 4;
        if(configure.getLhsdts()!=null && !"".equals(configure.getLhsdts())) {
            snum = Integer.parseInt(configure.getLhsdts());
        }
        int size = 0;
        for (int i = 0; i < jLabels.length; i++) {
            if (jLabels[i].getIcon() != null) {
                size++;
            }
        }
        if (type == 0) {
            if (jLabels[p].getIcon() != null) {
                jLabels[p].setIcon(null);
                size--;
            }
        } else {
            if (size >= snum) {
                ZhuFrame.getZhuJpanel().addPrompt2("当前版本只可以锁定"+snum+"条属性！");
                return;
            }
            if (jLabels[p].getIcon() == null) {
                jLabels[p].setIcon(CutButtonImage.getImage("skin/8100226/button/B88.png", -1, -1));
                size++;
            }
        }
        LianHua lianHua1 = UserMessUntil.getAllLianHua().get1000(size);
        LianHua lianHua2 = UserMessUntil.getAllLianHua().get2000(size);
        if (size == 0) {
            msg = null;
        } else if (size == 1) {
            if (leixing == 0) {
                msg = "消耗"+lianHua1.getMoney()+"仙玉锁定一条炼化属性";
            } else if (leixing == 1) {
                msg = "消耗"+lianHua2.getMoney()+"仙玉锁定一条炼化属性";
            }
        } else if (size == 2) {
            if (leixing == 0) {
                msg = "消耗"+lianHua1.getMoney()+"仙玉锁定二条炼化属性";
            } else if (leixing == 1) {
                msg = "消耗"+lianHua2.getMoney()+"仙玉锁定二条炼化属性";
            }
        } else if (size == 3) {
            if (leixing == 0) {
                msg = "消耗"+lianHua1.getMoney()+"仙玉锁定三条炼化属性";
            } else if (leixing == 1) {
                msg = "消耗"+lianHua2.getMoney()+"仙玉锁定三条炼化属性";
            }
        } else if (size == 4) {
            if (leixing == 0) {
                msg = "消耗"+lianHua1.getMoney()+"仙玉锁定四条炼化属性";
            } else if (leixing == 1) {
                msg = "消耗"+lianHua2.getMoney()+"仙玉锁定四条炼化属性";
            }
        }
        if (size > 0 && this.leixing == 1) {
            LianHua lianHua = UserMessUntil.getAllLianHua().get1000(size);//炼器显示  正常 100仙玉..
            this.msg = String.format(lianHua.getDes(), lianHua.getMoney());
        } if (size > 0 && this.leixing == 0) {
            LianHua lianHua = UserMessUntil.getAllLianHua().get2000(size);//
            this.msg = String.format(lianHua.getDes(), lianHua.getMoney());
        }
    }
    /** 获取锁定值 */
    public int getlock() {
        int lock = 0;
        int size = 0;
        for (int i = 0; i < jLabels.length; i++) {
            if (jLabels[i].getIcon() != null) {
                lock += Math.pow(10, i);
                size++;
            }
        }
        return lock * 10 + size;
    }

    class Gmouslisten implements MouseListener {
        private final int p;

        public Gmouslisten(int p) {
            super();
            this.p = p;
        }

        @Override
        public void mouseClicked(MouseEvent e) {
        }

        @Override
        public void mousePressed(MouseEvent e) {
            if (GameClient.lianhua == 0) {
                click(p, jLabels[p].getIcon() == null ? 1 : 0);
            }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }
    }

    public RefineOperBtn getBtnDown() {
        return btnDown;
    }

    public void setBtnDown(RefineOperBtn btnDown) {
        this.btnDown = btnDown;
    }

    public SkillSMSelectOptionJpanel getOptionJpanel() {
        return optionJpanel;
    }

    public void setOptionJpanel(SkillSMSelectOptionJpanel optionJpanel) {
        this.optionJpanel = optionJpanel;
    }
    public RefineOperBtn getOperBtn3() {
        return operBtn3;
    }
}
